<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
// Event::listen('illuminate.query',function($query){
//   	var_dump($query);
// });

//前台首页
Route::get('/', 'home\ShoplistController@home');

//登录页面
Route::get('/login','home\LoginController@login');
Route::post('/login','home\LoginController@dologin');

//去除session信息 退出登录
Route::get('logout','home\LoginController@logout');

//注册页面
Route::get('/register','home\LoginController@register');

Route::post('/register','home\LoginController@doregister');


Route::group(['middleware'=>'session'],function() {
	
	//个人中心页面
	Route::controller('/UserCenter','home\UserCenterController');
	// 用户信息修改
	Route::controller('/modify','home\ModifyController');
	//订单页面
	Route::get('/dingdan','home\DingDanController@index');

	Route::get('/dingdan/create','home\DingDanController@create');
	//收银页面
	Route::get('/dingdan/cashier','home\DingDanController@cashier');

	Route::post('/dingdan/alipay','home\DingDanController@alipay');
	}

);

// 用户信息修改
// Route::controller('/modify','home\ModifyController');


// 商家后台登陆
Route::get('/adminShop/shoperLogin','adminShop\Shoper\LoginController@login');

Route::post('/adminShop/shoperLogin','adminShop\Shoper\LoginController@doLogin');

//商家后台路由规则
Route::group(['middleware'=>'login'],function() {
	



Route::get('/adminShop','AdminController@index');
Route::controller('/good','adminShop\GoodController');
Route::controller('/type','adminShop\TypeController');
	
	

// 退出登陆
Route::get('/adminShop/logout','adminShop\Shoper\LoginController@logout');

// 商家更新资料
Route::get('/adminShop/update','AdminController@update');

Route::post('/adminShop/update','AdminController@doUpdate');

Route::get('/adminShop/shop','AdminController@home');

// 修改密码
Route::get('/adminShoper/modify','AdminController@modify');
Route::post('/adminShoper/modify','AdminController@doModify');

// 后台商品订单管理
Route::controller('/adminShop/order','adminShop\OrderController');

Route::controller('/adminShop/status','adminShop\StatusController');

});

// 商家注册
Route::resource('/adminShop/shoper','AdminShop\Shoper\RegisterController');








Route::get('/404', function(){
    abort(404,'not found!!!');
});




// 店铺列表
Route::get('/shoplist','home\ShoplistController@index');
//店铺默认排序
Route::get('/shopcreate','home\ShoplistController@create');
//美食评分排序
Route::get('shopcomment','home\ShoplistController@shopcomment');
//美食销量排序
Route::get('/shopsales','home\ShoplistController@shopsales');
//美食价格排序
Route::get('/shopprice','home\ShoplistController@shopprice');
//店铺评价
Route::get('/comment','home\ShoplistController@comment');
//购物车
Route::get('/shopcart','home\ShoplistController@cart');

//点击加入购物车
Route::get('/shopaddas','home\ShoplistController@shopaddas');

//订单页面
// Route::get('/dingdan','home\DingDanController@index');
// Route::get('/dingdan/create','home\DingDanController@create');
Route::get('/dingdan/addressid','home\DingDanController@addressid');

Route::get('/cartcart','home\ShoplistController@cartcart');
//清空购物车
Route::get('/del','home\ShoplistController@del');







//后台登录页面
Route::get('/admin/login','admin\LoginController@login');

//后台执行登录页面
Route::post('/admin/login','admin\LoginController@doLogin');




Route::group(['middleware'=>'logins'],function() {
	//后台主页
	Route::get('/admin','admin\AdminController@index');
	//后台用户列表
	Route::resource('/admin/user','admin\UserController');
	// Route::resource('/admin/user','admin\UserController');
	// Route::get('/admin/user','admin\UserController@delete');
	// Route::get('/admin/auth/{id}','admin\UserController@auth');

	//后台商家列表
	Route::resource('/admin/shop','admin\ShopersController');
	//后台店铺列表
	Route::resource('/admin/shops','admin\ShopsController');
	//后台退出登录页面
	Route::get('/admin/logout','admin\AdminController@logOut');

});






Route::get('/login','home\LoginController@login');
Route::post('/login','home\LoginController@dologin');

//去除session信息 退出登录
Route::get('logout','home\LoginController@logout');

//注册页面
Route::get('/register','home\LoginController@register');

Route::post('/register','home\LoginController@doregister');


Route::group(['middleware'=>'session'],function() {
	
	//个人中心页面
	Route::controller('/UserCenter','home\UserCenterController');
	
	// 用户信息修改
	Route::controller('/modify','home\ModifyController');
	}

);


//商品详情
Route::get('/goodscenter','home\ShoplistController@goodscenter');
//点击收藏
Route::get('/shoucang','home\ShoplistController@shoucang');
// 商家资质
Route::get('/shopercenters','home\ShoplistController@shopercenters');


